package com.hg.datagovernance.util;

import com.hg.datagovernance.exception.ParameterErrorException;
import com.hg.datagovernance.exception.ParameterLostException;

public class ValidateUtil {

    public static void validatePageNumberAndPageSize(Integer pageSize, Integer pageNum) {
        if (pageNum == null)
            throw new ParameterLostException("缺失页码");
        if (pageSize == null)
            throw new ParameterLostException("缺失条数");
        if (pageNum < 0)
            throw new ParameterErrorException("页码不符合规范");
        if (pageSize < 0 || pageSize > 1000)
            throw new ParameterErrorException("条数不符合规范");
    }
}
